package org.JWCB.judge.rabbitmq;


import lombok.extern.slf4j.Slf4j;
import org.JWCB.api.domain.judge.dto.JudgeSubmitDto;
import org.JWCB.common.core.constants.RabbitMQConstants;
import org.JWCB.judge.service.JudgeService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class JudgeConsumer {

    @Autowired
    private JudgeService judgeService;


    @RabbitListener(queues = RabbitMQConstants.OJ_WORK_QUEUE)
    public void consume(JudgeSubmitDto judgeSubmitDto) {
        log.info("收到消息{} ",judgeSubmitDto);
        judgeService.doJudgeJavaCode(judgeSubmitDto);
    }
}
